Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Dec 9, 2024

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

ndossche and others added 13 commits December 9, 2024 21:00
Agreed by RM: #16168 (comment)

The inline assembly uses labels with the prefix `.L`. On Linux systems
this is the local label prefix. It appears that macOS uses `L` as a
local prefix, which means that the prefix used in the inline assembly is not
local for macOS systems [1].
When combined with inlining, this causes the compiler to get confused
and merge a part of the inline assembly between different functions,
causing control flow to jump from one function to another function.
This is avoided on PHP 8.2 and up by the fact that it
uses `zend_never_inline NOIPA`, but nothing guarantees that compiler
changes won't affect this as well.

To solve this issue, we instead use local labels. These will make the
compiler pick the correct prefix, preventing the issue.

Additionally, while here, we also change the computation of `delta`.
It is undefined behaviour to compute the pointer difference between
two different objects. To circumvent this, we cast first to `uintptr_t`.

This change is cleanly backportable to 8.1 for vendors to pick up.

[1] #16168 (comment)

With the help of investigation and testing of @ryandesign.

Closes GH-16348.
* PHP-8.4:
  Backport GH-16348
The directives for FFI should be first in the file, which is fine,
however sometimes there can be comments or whitespace before or between
these defines. One practical example is for license information or when
a user adds newlines "by accident". In these cases, it's quite confusing
that the directives do not work properly.
To solve this, make the zend_ffi_parse_directives() aware of comments.

Closes GH-17082.
* PHP-8.3:
  Fix bug #79075: FFI header parser chokes on comments
* PHP-8.4:
  Fix bug #79075: FFI header parser chokes on comments
@pull pull bot added the ⤵️ pull label Dec 9, 2024
@pull pull bot merged commit 8ef9302 into wudi:master Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants